package com.seal.service.impl;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import com.seal.dao.IBusiImageDao;
import com.seal.dto.BusiImageDto;
import com.seal.model.BusiImage;
import com.seal.service.IBusiImageService;

@Service("busiImageServiceImpl")
@Transactional(readOnly = true)
public class BusiImageServiceImpl implements IBusiImageService {

	@Resource(name = "busiImageDaoImpl")
	private IBusiImageDao busiImageDao;

	@Transactional(propagation = Propagation.REQUIRED,readOnly = false, rollbackForClassName = "Exception")
	public void addBusiImages(List<BusiImage> list) throws Exception {
		busiImageDao.addBusiImages(list);
	}

	@Transactional(propagation = Propagation.REQUIRED,readOnly = false, rollbackForClassName = "Exception")
	public void deleteBusiImage(BusiImage busiImage) throws Exception {
		busiImageDao.deleteBusiImage(busiImage);
	}

	
	public BusiImage getBusiImageById(Long id) throws Exception {
		return busiImageDao.getBusiImageById(id);
	}

	public List<BusiImage> getBusiImages(BusiImageDto dto) throws Exception {
		return busiImageDao.getBusiImages(dto);
	}

	@Transactional(propagation = Propagation.REQUIRED,readOnly = false, rollbackForClassName = "Exception")
	public void updateBusiImage(BusiImage busiImage) throws Exception {
		busiImageDao.updateBusiImage(busiImage);
	}

	public int getUseSpacesize(Long companyId) throws Exception {
		return busiImageDao.getUseSpacesize(companyId);
	}
	
}
